<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
  <th:block th:include="include-nblog :: seo" />
  <th:block th:include="include-nblog :: header-res" />
    <!--默认风格-->
<!--    <link th:href="@{/blog/css/jquery.my-modal.1.1.css}" type="text/css" rel="stylesheet">-->
    <!--win风格-->
<!--    <link th:href="@{/blog/css/jquery.my-modal.1.1.winStyle.css}" type="text/css" rel="stylesheet">-->
    <style>
        .r_label {
            width: 80px;
            display: inline-block;
        }

        input.btn-normal {
            background: #0e82e8;
            color: #fff;
            border: none;
            padding: 10px 0;
            border-radius: 5px;
            width: 10%;
        }

        input.btn-small {
            background: #0e82e8;
            color: #fff;
            border: none;
            padding: 2px 0;
            border-radius: 2px;
            width: 10%;
        }

        .page-main {
            line-height: 24px;
            margin-top: 20px;
        }

        .page-main div {
            line-height: 35px;
        }
    </style>
</head>
<body>
<!--top begin-->
<th:block th:include="include-nblog :: header-nav" />
<!--top end-->
<article>

    <th:block th:include="include-nblog :: content-left-menu" />

  <!--lbox begin-->
  <div class="rbox-s">
    <div class="content_box whitebg">
<!--      <input type="hidden" id="contentId" th:value="${content.id}">-->
<!--        <input type="hidden" id="videoUrl" th:value="${content.videoUrl}">-->
<!--        <input type="hidden" id="imgUrl" th:value="${content.imgUrl}">-->
      <h2 class="htitle">
        <span class="con_nav">您现在的位置是：<a href="" >个人中心</a>
          ><a href="" >系统设置</a>
        </span>
        系统设置
      </h2>


      <div class="page-main">
          <div>
              视频存储目录：<input type="text" id="videoStorePath" name="videoStorePath" style="width:350px" />
              <input type="button" id="btnSelectDir" class="btn-small"  value="选择" />

          </div>
          <div>
              <input type="button" id="btnSave" class="btn-normal"  value="保存" />
          </div>
      </div>


    </div>


  </div>
  <!--lbox end-->


</article>

<th:block th:include="include-nblog :: footer" />
<link th:href="@{/blog/css/style.css}" rel="stylesheet">

<script type="module">
    import {$methodCall} from '/blog/js/ipcRenderer.js'
    console.log($methodCall)
    let model = {
        videoStorePath:''
    }

    $(document).ready(function(){
        init();
    });

    const methodCallOptions = {actionLoadingField:'checkLoading',msgTip:true};
    const init = function () {
        const $this = this;
        $methodCall(this,'settings','getInitData',model,{msgTip:false},function(res){
            if(res.success){
                // model = JSON.parse(JSON.stringify(res.data));
                $("#videoStorePath").val(res.data.videoStorePath);
            }
        });
    };

    const selectDir = function() {
        const $this = this;
        // $this.pathValidateStatus = 'validating';
        let videoStorePath = $("#videoStorePath").val();
        $methodCall(this,'system','selectFolder',videoStorePath,methodCallOptions,function(res){

            if(res.success){
                // model = JSON.parse(JSON.stringify(res.data));
                $("#videoStorePath").val(res.data);
            }
        });

        // $this.$ipcInvoke(ipcApiRoute.selectFolder, $this.model.videoStorePath).then(r => {
        //     if(r){
        //         $this.model.videoStorePath = r;
        //     }
        //     // self.$message.info(r);
        //     $this.pathValidateStatus = 'success';
        // })
    }


    const save = function(){
        const $this = this;
        $methodCall(this,'system','save',{"videoStorePath":$("#videoStorePath").val()},methodCallOptions,function(res){
            if(res.success){
                // $this.model = JSON.parse(JSON.stringify(res.data));
            }
        });
    };

    document.querySelector('#btnSelectDir').addEventListener('click', (e) => selectDir());
    document.querySelector('#btnSave').addEventListener('click', (e) => save());



</script>
<!--单词字典查看-->
<!--<th:block th:include="include-wordDict :: wordDict" />-->

</body>
</html>
